package GameEngine.Animation;

import GameEngine.helper.PAppletBridge;

public class TimeBase {

	private int startTime = 0;
	private int currentTime = 0;
	private int numberTicks = 0;
	private int tickSize = 40; // 40 Millisekunden pro Tick
	private boolean pause = false;

	public TimeBase() {
		reset();
	}

	public void reset() {
		startTime = PAppletBridge.millis();
	}

	public int getTicks() {
		if (!pause) {
			numberTicks = millisToTicks();
		}
		return numberTicks;
	}

	public int getTicksSinceLastRequest() {
		return (millisToTicks() - numberTicks);
	}

	private int millisToTicks() {
		return ((PAppletBridge.millis() - startTime) / tickSize);
	}

	// Getter und Setter
	public boolean isPause() {
		return pause;
	}

	public void setPause(boolean pause) {
		this.pause = pause;
	}

}
